<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>用户列表</title>
    <style>
        table { border-collapse: collapse; width: 80%; margin: 20px auto; }
        th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
        th { background-color: #f2f2f2; }
    </style>
</head>
<body>
<h1 style="text-align: center;">用户管理</h1>
<div style="text-align: center; margin: 10px;">
    <a th:href="@{/users/new}" style="padding: 8px 16px; background: #4CAF50; color: white; text-decoration: none;">
        新增用户
    </a>
</div>
<table>
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>邮箱</th>
        <th>年龄</th>
    </tr>
    <!-- 遍历用户列表 -->
    <tr th:each="user : ${users}">
        <td th:text="${user.id}"></td>
        <td th:text="${user.name}"></td>
        <td th:text="${user.email}"></td>
        <td th:text="${user.age}"></td>
    </tr>
</table>
</body>
</html>